# Maintainer: David Runge <dvzrv@archlinux.org>

_name=rcssmin
pkgname=python-rcssmin
pkgver=1.1.1
pkgrel=2
pkgdesc="Fast CSS minifier for Python"
arch=(loong64 x86_64)
url="https://github.com/ndparker/rcssmin"
license=(Apache)
depends=(python)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('3439808f0e9165cac33756a2664fb4e3a314107422a952ebd42b28653519d91ba9e8f775cd499078c6d3faf103415c7c66eec05258f2dcfe85fee4f253399dfd')
b2sums=('20a67546400f8fa86250a814f0a4b71e7f30df8ed8f9d0426d2ad097706174b082ad9645ca293c7477f0786ea42aca3c2a85b1fb1f32e30d44e816c10985a896')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd $_name-$pkgver
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
